package com.py.pythink.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.py.pythink.bo.BrowseBo;
import com.py.pythink.entity.Browse;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author jls
 * @date 2021/7/7 21:06
 */
@Repository
public interface BrowseDao extends BaseMapper<Browse> {
    //由uid 查找fid结果是List集合
    @Select("select t_browse.fid from t_browse where uid = #{uid}")
    List<Integer> findfid(@Param("uid")int uid);

    //由fid联合t_fimage和t_teenment 两表联合查询房图片的url地址和房子的信息
    //或许还要建立一个BO 里边封装得到的URL 和房子的信息
    @Select("select oss.preurl,sel.address,sel.price,sel.info,sel.area  \n" +
            "from(t_fimage fim inner join t_osslog oss on fim.oid=oss.id)\n" +
            "inner join t_sellers sel on fim.fid=sel.id where sel.id=#{fid}")
    BrowseBo findBrowseBo(int fid);

    //修改标记位 删除
    @Update("update t_browse set flag=2 where fid=#{fid}")
    int update1(Integer fid);
}
